<template>
	<div class="easyd-weixin-Box">

		<div class="app_page_box">
			<div class="app_page">

				<div class="app_list_box MARGIN_BOTTOM_10">
					<div class="app_box_content">
						<div class="app_box_content_left">
							选择日期
						</div>
						<div class="app_box_content_right" @click="openPicker()">
							<span>{{pickerTxt}}</span>
							<i class="fa fa-angle-right fa-lg"></i>
						</div>
					</div>
					<template>
						<mt-datetime-picker ref="picker" v-model="pickerValue" type="date" year-format="{value} 年" month-format="{value} 月" date-format="{value} 日" @confirm="handleConfirm()"></mt-datetime-picker>
					</template>
				</div>

			</div>
		</div>

	</div>
</template>

<script>
	import { mapState, mapMutations } from "vuex";
	export default {

		data() {
			return {
				pickerValue: new Date(),
				pickerTxt: '请选择',
			};
		},
		computed: {
			...mapState({
				// followTime: state => state.AddFollowModule.followTime,
			})
		},
		mounted() {
			this.openPicker();
		},
		methods: {

			//  ...mapMutations(["ShopIndexModule/updateIsShopGuide"]),

			openPicker() {
				this.$refs.picker.open();
			},
			handleConfirm(e) {
				this.pickerTxt = this.$common.getTimes(this.pickerValue/1000);
				console.log(this.pickerTxt);
				if(this.$route.query.source == 'addClient'){
					this.$store.commit("AddClientModule/updateCampusStartTime", this.pickerTxt);
				}else{
					this.$store.commit("AddFollowModule/updateFollowTime", this.pickerTxt);
				}
				history.go(-1);
			},
		}
	};
</script>

<style lang="stylus" scoped>
	@import '~PUBLIC_CSS';
	.history_follow_info {
		padding: 10px;
		border-bottom: 1px solid #f1f1f1;
	}
	
	.history_follow_info .app_box_content_textarea {
		padding: 0;
		position: relative;
	}
	
	.history_follow_info .app_box_content_textarea textarea {
		background: #F4F4F4;
		padding: 10px;
	}
	
	.history_follow_info .app_box_content_textarea span {
		position: absolute;
		right: 1px;
		bottom: 1px;
		font-size: small;
		color: #999;
		background: #f4f4f4;
		padding: 5px;
	}
</style>